#include<iostream.h

来源:百度知道 编辑:UC知道 时间:2024/05/16 19:21:15
#include<iostream.h>
#include <stdlib.h>
main(){
int a;
cout<<"a=";
cin>>a;
int b;
cout<<"b=";
cin>>b;
cout<<"a+b="<<a+b<<endl;

int spppp; cin>>spppp;
system("pause");
system("pause");
}
为什么不显示结果

在我这行啊,a,b,spppp都要输入的,你都输入了数据了吧,还有你最好在main前加一句:using namespace std;

#include<iostream.h>
改成
#include<iostream>
using namespace std;

为什麼要加using namespace std;啊?

我完全按你的代码在VC++上试了下,显示正常啊!
结果如下:
a=2
b=3
a+b=5
10
请按任意键继续...
请按任意键继续...

问一下,你用的是c++ 6.0 还是visual studio 2005.
如果是2005,把#include<iostream.h> 改成#include<iostream>
using namespace std;
不显示结果在最后加一句显屏:
cin.ignore(cin.rdbuf->in_avail()+1);
还有你没有定义主函数main()得类型。